package com.junxi.microservices.bookstore.product.client;

import com.junxi.microservices.bookstore.product.config.FeignClientConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

// 调用inventory-service服务
@FeignClient(name = "inventory-service", path = "/inventory/api/inventory", configuration = FeignClientConfig.class)
public interface InventoryFeignClient {

    /**
     * 检查产品库存
     * @param productId 产品名称
     * @return 库存信息
     */
    @GetMapping("/{productId}")
    InventoryResponse checkInventory(@PathVariable("productId") Long productId);

    record InventoryResponse(Long productId, Integer quantity) {}
}

